package cn.zzq.userscenter.auth.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.zzq.userscenter.users.pojo.AAdminsEnum;

/**
 * 管理员表的POJO
 * 
 * @author WangshSxt
 */
public class AMenu implements Serializable
{
	private int id;
	private int parentId;
	private String name;
	private String content;
	private String url;
	private byte status;
	private byte isLeafStatus;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	/* 关联对象 */
	private AMenu parentMenu;
	private List<AMenu> childMenuList = new ArrayList<>();
	
	/* 字符串描述 */
	private String statusStr ; 


	/**
	 * 状态:0:禁用,1:启用
	 * 
	 * 根据status的值显示对应的字符串(从枚举中取值)
	 * @return
	 */
	public String getStatusStr()
	{
		/*
		 * 循环枚举
		 */
		AAdminsEnum[] adminsEnums = AAdminsEnum.values();
		for (int i = 0; i < adminsEnums.length; i++)
		{
			AAdminsEnum adminsEnum = adminsEnums[i];
			/* 一个表中有多个byte类型的字段(枚举)
			 * 不同的byte字段可以有相同的值,
			 * 所以在判断的时候,即要判断值,又要判断名称
			 *  */
			if(this.getStatus() == adminsEnum.getStatus() && adminsEnum.toString().startsWith("STATUS"))
			{
				this.statusStr = adminsEnum.getInfo() ; 
			}
			/*ConstatFinalUtil.SYS_LOGGER.info("info:{},status:{},属性名:{}",
					adminsEnum.getInfo(),adminsEnum.getStatus(),adminsEnum);*/
		}
		return statusStr;
	}


	public int getId()
	{
		return id;
	}


	public void setId(int id)
	{
		this.id = id;
	}


	public int getParentId()
	{
		return parentId;
	}


	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}


	public String getName()
	{
		return name;
	}


	public void setName(String name)
	{
		this.name = name;
	}


	public String getContent()
	{
		return content;
	}


	public void setContent(String content)
	{
		this.content = content;
	}


	public String getUrl()
	{
		return url;
	}


	public void setUrl(String url)
	{
		this.url = url;
	}


	public byte getStatus()
	{
		return status;
	}


	public void setStatus(byte status)
	{
		this.status = status;
	}


	public byte getIsLeafStatus()
	{
		return isLeafStatus;
	}


	public void setIsLeafStatus(byte isLeafStatus)
	{
		this.isLeafStatus = isLeafStatus;
	}


	public Date getCreateTime()
	{
		return createTime;
	}


	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}


	public Date getUpdateTime()
	{
		return updateTime;
	}


	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public void setStatusStr(String statusStr)
	{
		this.statusStr = statusStr;
	}


	/**
	 * @return the pubTime
	 */
	public Date getPubTime()
	{
		return pubTime;
	}


	/**
	 * @param pubTime the pubTime to set
	 */
	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}


	/**
	 * @return the parentMenu
	 */
	public AMenu getParentMenu()
	{
		return parentMenu;
	}


	/**
	 * @param parentMenu the parentMenu to set
	 */
	public void setParentMenu(AMenu parentMenu)
	{
		this.parentMenu = parentMenu;
	}


	/**
	 * @return the childMenuList
	 */
	public List<AMenu> getChildMenuList()
	{
		return childMenuList;
	}


	/**
	 * @param childMenuList the childMenuList to set
	 */
	public void setChildMenuList(List<AMenu> childMenuList)
	{
		this.childMenuList = childMenuList;
	}


}
